<template>
	<view class="page">
		<u-form ref="uForm">
			<u-form-item :leftIconStyle="{ color: '#888', fontSize: '32rpx' }" label-width="120" label="帐号：" prop="name">
				<u-input placeholder="请输入帐号" type="text" v-model="username"></u-input>
			</u-form-item>
			<u-form-item label="密码：" label-width="120" prop="password">
				<u-input :password-icon="true" type="password" placeholder="请输入密码" v-model="password"></u-input>
			</u-form-item>
		</u-form>
		<view class="btn">
			<u-button type="primary" @click="register">立即注册</u-button>
		</view>
	</view>
</template>

<script>
export default {
	components: {},
	data() {
		return {
			username: '',
			password: '',
		};
	},
	onShow() {
		
	},
	methods: {
		
		register() {
			if (this.username.length < 5) {
				uni.showToast({
					icon: 'none',
					title: '账号最短为 5 个字符',
				});
				return;
			}
			if (this.password.length < 6) {
				uni.showToast({
					icon: 'none',
					title: '密码最短为 6 个字符',
				});
				return;
			}
			uni.showLoading({
				title: '注册',
			});
			setTimeout(function(){
				uni.hideLoading()
				uni.reLaunch({
					url: '/pages/login/login',
				});
			},300)
			
		},
	},
};
</script>

<style lang="scss" scoped>
.u-form {
	padding: 15px 0;
	.u-form-item {
		padding: 10px;
		background: #fff;
	}
}

.btn {
	padding: 0 15px;
}
</style>
